var __extends =
    (this && this.__extends) ||
    (function () {
      var t = function (n, i) {
        return (t =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (t, n) {
              t.__proto__ = n;
            }) ||
          function (t, n) {
            for (var i in n)
              Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]);
          })(n, i);
      };
      return function (n, i) {
        function e() {
          this.constructor = n;
        }
        if ("function" != typeof i && null !== i)
          throw new TypeError(
            "Class extends value " + String(i) + " is not a constructor or null"
          );
        t(n, i),
          (n.prototype =
            null === i
              ? Object.create(i)
              : ((e.prototype = i.prototype), new e()));
      };
    })(),
  FactionContributeDialog = (function (t) {
    function n() {
      var n = t.call(this) || this;
      return (
        (n.max = 15e3),
        (n.min = 0),
        (n.step = 1),
        (n.num = 0),
        (n.contri_value = ""),
        n.btn_fac_gx_del.on(Laya.Event.CLICK, n, n.onDidClickEditBPItemFn),
        n.btn_fac_gx_add.on(Laya.Event.CLICK, n, n.onDidClickEditBPItemFn),
        n.slider_fac_gongxian.on(Laya.Event.CHANGE, n, n.onSliderEditChange),
        n.btn_bangpai_gongxian.on(Laya.Event.CLICK, n, n.okButtonDidClick),
        WebSocketService.addListener({
          caller: n,
          code: 1451,
          method: n.onLoadMySelfMoneyDataFn,
        }),
        WebSocketService.addListener({
          caller: n,
          code: 1224,
          method: n.onLoadBangPaiGongxianDataFn,
        }),
        n
      );
    }
    return (
      __extends(n, t),
      (n.showContributionView = function (t) {
        return (
          null == this.factribution &&
            ((this.factribution = new n()), (this.factribution.zOrder = 1e3)),
          this.factribution.popup(!0),
          WebSocketService.send({ c: 1451 }),
          (this.factribution.label_gongxiandu_value.text = t),
          (this.factribution.slider_fac_gongxian.value = 0),
          (this.factribution.contri_value = t),
          this.factribution
        );
      }),
      (n.prototype.onLoadMySelfMoneyDataFn = function (t) {
        (this.label_bangpai_money.text = t.data.money + "银"),
          (this.slider_fac_gongxian.min = 0);
        var n = Math.floor(t.data.money / 100),
          i = parseInt(this.contri_value);
        n + i > 15e3 && (n = 15e3 - i), (this.slider_fac_gongxian.max = n);
      }),
      (n.prototype.onDidClickEditBPItemFn = function (t) {
        "item0" == t.target.name
          ? ((this.num = this.num - this.step),
            this.num < this.min && (this.num = this.min),
            (this.slider_fac_gongxian.value = this.num))
          : "item1" == t.target.name &&
            ((this.num = this.num + this.step),
            this.num > this.max && (this.num = this.max),
            (this.slider_fac_gongxian.value = this.num)),
          (this.label_gongxian_money.text =
            100 * this.slider_fac_gongxian.value + "银"),
          this.slider_fac_gongxian.value > 0
            ? (this.label_gongxiandu_value.text =
                this.contri_value + " +" + this.slider_fac_gongxian.value)
            : (this.label_gongxiandu_value.text =
                this.slider_fac_gongxian.value + "");
      }),
      (n.prototype.onSliderEditChange = function () {
        (this.num = this.slider_fac_gongxian.value),
          (this.label_gongxian_money.text =
            100 * this.slider_fac_gongxian.value + "银"),
          this.slider_fac_gongxian.value > 0
            ? (this.label_gongxiandu_value.text =
                this.contri_value + " +" + this.slider_fac_gongxian.value)
            : (this.label_gongxiandu_value.text =
                this.slider_fac_gongxian.value + "");
      }),
      (n.prototype.okButtonDidClick = function () {
        if (this.slider_fac_gongxian.value <= 0)
          ToastView.toastView("请先输入贡献金币");
        else {
          var t = 100 * this.slider_fac_gongxian.value;
          WebSocketService.send({ c: 1224, d: { money: t } }),
            Laya.stage.event("GameMainView", "moeny"),
            Laya.stage.event("HomePageView", "moeny");
        }
      }),
      (n.prototype.onLoadBangPaiGongxianDataFn = function (t) {
        ToastView.toastView(t.msg),
          this.close(),
          WebSocketService.send({ c: 1126 });
      }),
      n
    );
  })(ui.FactionController.FactionContributeDialogUI);
